import socket
import sys

s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host = socket.gethostname()
port = 9999
s.connect((host,port))
msg = s.recv(1024)

print(msg.decode('utf-8'))
while True:
    inp = input("对话框:")
    if inp == 'exit':
        break
    s.send(inp.encode('utf-8'))
    data = s.recv(1024)
    print(str(data,'utf-8'))